
export const host = "https://apis.netstart.cn/music"

// 封装get请求
const get = (url,data={})=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:host+url,
			data:data,
			method:'GET',
			success(res) {
				resolve(res.data)
			},
			fail(err){
				reject('请求失败')
			}
		})
	})
}

// 封装post请求
const post = (url,data={})=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:host+url,
			data:data,
			method:'POST',
			header:{
				"Content-Type":"application/x-www-form-urlencoded"
			},
			success(res) {
				resolve(res.data)
			},
			fail(err){
				reject('请求失败')
			}
		})
	})
}

// 推荐歌单接口
export const getRecomment = (data={}) => {
	return get('/personalized',data)
}

// 排行榜接口
export const getToplist = (data={}) => {
	return get('/toplist',data)
}

// 每日推荐歌曲接口
export const getMusicRecommend = (data={}) => {
	return get('/recommend/songs',data)
}
// 歌曲详情接口
export const getMusicDetail = (data={}) => {
	return get('/song/detail',data)
}

// 歌曲URL接口
export const getMusicUrl = (data={}) => {
	return get('/song/url',data)
}

// 歌词接口
export const getMusicLyric = (data={}) => {
	return get('/lyric',data)
}

// 歌单详情接口
export const getMeauDetail = (data={}) => {
	return get('/playlist/detail',data)
}

// 歌单歌曲接口
export const getMeauSongs = (data={}) => {
	return get('/playlist/track/all',data)
}

// 热搜接口
export const getSearchHot = (data={}) => {
	return get('/search/hot/detail',data)
}

// 搜索接口
export const getSearch = (data={}) => {
	return get('/cloudsearch',data)
}

// 歌单分类接口
export const getTags = (data={}) => {
	return get('/playlist/highquality/tags',data)
}

// 精品歌单接口
export const getHighPlaylist = (data={}) => {
	return get('/top/playlist/highquality',data)
}

